package com.glueball.crm.module.client.ui;

import com.glueball.crm.module.client.model.Contact;
import com.glueball.crm.module.common.ui.EditableWidget;
import com.glueball.crm.module.common.ui.EditableWidget.StartView;
import com.glueball.crm.module.common.ui.EditableWidgetFactory;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.SimplePanel;

public class ContactWidgetFactory implements EditableWidgetFactory<Contact> {

	private final String saveUrl;

	public ContactWidgetFactory(String saveUrl) {
		this.saveUrl = saveUrl;
	}

	public EditableWidget<Contact> build(
			final Contact entity,
			final SimplePanel showPanel,
			final HorizontalPanel controllerPanel,
			final StartView startView) {
		return new ContactWidget(entity, showPanel, controllerPanel, startView, saveUrl);
	}

	public EditableWidget<Contact> build(
			final SimplePanel showPanel,
			final HorizontalPanel controllerPanel,
			final StartView startView) {
		return new ContactWidget(new Contact(), showPanel, controllerPanel, startView, saveUrl);
	}
}
